The JavaScript Tailor

This JavaScript Applet will attempt to guess a man's measurements from his weight and waistline.
Waistline: 
   Weight: 
           
        
        

Discussion

This example makes extensive use of JavaScript mathematical formulas. For example, this script guesses a man's hat size to be approximately five times his weight (in pounds) divided by his waist (in inches) divided again by two and an eighth. In JavaScript, this formula looks like this.
(5.0 * (weight / waist)) / 2.125
Always be careful to check your formulas carefully and make sure that your parentheses match. Assure your functions have open and close brackets and are commented liberally. Test your formulas out on some known examples and try to make sure in advance that they work.

Note: This example was inspired by the writings of Doug Cooper and Michael Clancy.

Copyright ©1998 by Charles River Media, All Rights Reserved